package com.chhuang.system.po;

import java.io.Serializable;
import com.chhuang.core.model.AbstractPersistentModel;
import com.chhuang.core.validation.ValidGroupSave;
import com.chhuang.core.validation.ValidGroupUpdate;
import com.sun.xml.bind.CycleRecoverable;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.*;

/**
* ChUser Model
* @author ChHuang
* @date Thu Mar 09 09:01:29 CST 2017
*/
public class ChUser extends AbstractPersistentModel implements CycleRecoverable{
	private static final long serialVersionUID = 2991267074651681777L;
	@NotNull(message="{ChUser.userId.NotNull}",groups={ValidGroupUpdate.class})
	@Size(max=32,message="{ChUser.userId.Size}",groups={ValidGroupSave.class})
	private String userId;
	public String getUserId(){
		return userId;
	}
	public void setUserId(String userId){
		this.userId=userId;
	}
	@NotNull(message="{ChUser.username.NotNull}",groups={ValidGroupUpdate.class,ValidGroupSave.class})
	@Size(max=32,message="{ChUser.username.Size}",groups={ValidGroupSave.class})
	private String username;
	public String getUsername(){
		return username;
	}
	public void setUsername(String username){
		this.username=username;
	}
	@NotNull(message="{ChUser.password.NotNull}",groups={ValidGroupUpdate.class})
	@Size(max=32,message="{ChUser.password.Size}",groups={ValidGroupSave.class})
	private String password;
	public String getPassword(){
		return password;
	}
	public void setPassword(String password){
		this.password=password;
	}
	@Size(max=32,message="{ChUser.nickname.Size}",groups={ValidGroupSave.class})
	private String nickname;
	public String getNickname(){
		return nickname;
	}
	public void setNickname(String nickname){
		this.nickname=nickname;
	}
	@Size(max=16,message="{ChUser.phone.Size}",groups={ValidGroupSave.class})
	private String phone;
	public String getPhone(){
		return phone;
	}
	public void setPhone(String phone){
		this.phone=phone;
	}
	@Size(max=128,message="{ChUser.email.Size}",groups={ValidGroupSave.class})
	private String email;
	public String getEmail(){
		return email;
	}
	public void setEmail(String email){
		this.email=email;
	}
	@Override
	public Serializable getId() {
		return getUserId();
	}
	@Override
	public void setId(Serializable id) {
		setUserId((String)id);
	}
	@Override
	public Object onCycleDetected(Context arg0) {
		ChUser temp=new ChUser();
		temp.setUserId(userId);
		return temp;
	}
	@Override
	public String toString() {
		return "ChUser [userId="+userId+",username="+username+",password="+password+",nickname="+nickname+",phone="+phone+",email="+email+"]";
	}
}